/*
 *  ACaptureMask.cpp
 *  libavid
 *
 *  Created by Peter on 26.02.12.
 *  Copyright 2012 __MyCompanyName__. All rights reserved.
 *
 */

#include "ACaptureMask.h"
#include "AStream.h"

#include <iomanip>

A_IMPLEMENT_CLASS( 'MASK', ACaptureMask, ATimeWarp );

void ACaptureMask::readFromStream( AStream& str, const AObjDoc& objd )
{
	ATimeWarp::readFromStream( str, objd );
	
	UInt8 tagMark, version;
	str.readPod( tagMark );
	str.readPod( version );
	TR_ASSERT( tagMark == 0x02 );
	TR_ASSERT( version == 0x01 );
	
	_isDouble = str.readBool();
	str.readPod( _maskBits );
	
	str.readPod( tagMark );
	TR_ASSERT( tagMark == 0x03 );
}

void ACaptureMask::dump( std::ostream& str ) const
{	
	std::ios::fmtflags flags = str.flags();
	
	str << "ACaptureMask {" << std::endl;
	
	str << "\t";
	ATimeWarp::dump( str );
	
	str << "_isDouble: " << ( _isDouble ? "True" : "False" ) << std::endl;
	str << "_maskBits: " << std::ios::binary << _maskBits << std::endl;
	
	str.flags( flags );
	
	str << "}" << std::endl;
}